package com.pri.chat.adapter;

import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.DataSource;
import com.bumptech.glide.load.engine.GlideException;
import com.bumptech.glide.request.RequestListener;
import com.bumptech.glide.request.target.Target;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.luck.picture.lib.tools.ScreenUtils;
import com.netease.nim.uikit.common.util.sys.ScreenUtil;
import com.netease.nim.uikit.net.SharedHelper;
import com.netease.nim.uikit.net.entity.MemberBean;
import com.pri.chat.R;
import com.pri.chat.utils.GlideUtil;
import com.pri.chat.utils.StringUtils;
import com.pri.chat.view.ImageViewPlus;

import java.util.List;

/**
 * 描述：添加类的描述
 *
 * @author
 * @time 2020/4/30
 */
public class MemberJggAdapter extends BaseQuickAdapter<MemberBean, BaseViewHolder> {

    public MemberJggAdapter(int layoutResId, @Nullable List<MemberBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MemberBean item) {
        helper.setText(R.id.item_city, StringUtils.isEmpty(item.getCity())?"":item.getCity());
        helper.setText(R.id.item_title,StringUtils.isEmpty(item.getName())?"":item.getName());
        helper.setText(R.id.item_sign,StringUtils.isEmpty(item.getSignInfo())?"":item.getSignInfo());

        ImageViewPlus plus = helper.getView(R.id.item_img);
        int width = (ScreenUtils.getScreenWidth(mContext)-ScreenUtils.dip2px(mContext,30))/2;
        ViewGroup.LayoutParams params = plus.getLayoutParams();
        params.height = width;
        plus.setLayoutParams(params);

        GlideUtil.getInstance().loadHeadImg(mContext,plus,item.getHeadPic());
    }
}
